package com.xiaoma.verbal.service;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaoma.verbal.dao.PrctAssistantDao;
import com.xiaoma.verbal.domain.PrctAssistant;

@Service
public class PrctAssistantService {
	@Autowired
	private PrctAssistantDao prctAssistantDao;

	public void merge(Integer xbId, String nickName) {
		PrctAssistant bean = this.prctAssistantDao.getById(xbId);
		if (bean != null) {
			bean.setNickName(nickName);
			bean.setUpdateTime(new Date());
			this.prctAssistantDao.update(bean);
		} else {
			bean = new PrctAssistant();
			bean.setId(xbId);
			bean.setNickName(nickName);
			bean.setCreateTime(new Date());
			bean.setUpdateTime(bean.getCreateTime());
			this.prctAssistantDao.insert(bean);
		}
	}
}
